package org.luxor.eshop.order.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.luxor.commons.core.utils.DateUtils;
import org.luxor.commons.core.validator.group.UpdateGroup;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;


/**
 * 订单
 *
 * @author administrator @date 2020-12-04 15:47:45
 */
@Data
@TableName("tb_order")
@ApiModel(description = "")
public class OrderEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	@TableId(type = IdType.ASSIGN_ID)
	@ApiModelProperty(value = "主键Id")
	@JSONField(serializeUsing = ToStringSerializer.class)
	@NotNull(message = "orderId，不能为空", groups = UpdateGroup.class)
	private Long orderId;

	@ApiModelProperty(value = "买家账户")
	@NotBlank(message = "account，不能为空")
	private String account;

	@ApiModelProperty(value = "总金额")
	@NotNull(message = "money，不能为空")
	private BigDecimal money;

	@ApiModelProperty(value = "支付状态(0-支付中；1-已支付；2-支付失败)")
	private Byte status;

	@ApiModelProperty(value = "备注")
	private String remark;

	@ApiModelProperty(value = "创建时间")
	@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN, timezone = "GMT+8")
	private Date createTime;

	@ApiModelProperty(value = "付款时间")
	@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN, timezone = "GMT+8")
	private Date payTime;

	@ApiModelProperty(value = "支付期限")
	@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN, timezone = "GMT+8")
	private Date dueTime;

}
